using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;
using System.Text;


public partial class Pages_Raw_Material_Account : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBoxacctype.Text = Common.stkAccType.ToString();
        TextBoxacccode.Text = Common.stkAccCode.ToString();
    }
    protected void ButtonStoreAccount_Click(object sender, EventArgs e)
    {
        #region connect to database and save the account info in corresponding row of stock table

        string conString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

        //string conString = @"Provider=SQLSql;Data Source=CSE-PC\SQLEXPRESS;User ID=sa;Initial Catalog=DB2011;Password=1234";
        SqlCommand myCommInsert = new SqlCommand();
        myCommInsert.Connection = new SqlConnection(conString);
        myCommInsert.Connection.Open();



        string strQuery2 = "UPDATE stock SET acccode=" + Common.accCodeValue.ToString() + ", acctype=" + Common.accTypeValue.ToString() + " WHERE itype=" + Common.stkTypeValue.ToString() + " and icode=" + Common.stkCodeValue.ToString();
        TextBox1.Text = strQuery2;
        myCommInsert.CommandText = strQuery2;
        myCommInsert.ExecuteNonQuery();

        myCommInsert.Connection.Close();
        #endregion
    }
}
